﻿#region Copyright 2011 Mike Goatly
// This source is subject to the the MIT License (MIT)
// All rights reserved.
#endregion

namespace Lifti.Querying
{
    using System;
    using System.Globalization;
    using System.Runtime.Serialization;

    /// <summary>
    /// The <see cref="QueryParserException"/> may be thrown by various parts of the query parsing code.
    /// </summary>
#if !NETFX_CORE
    [Serializable]
#endif
    public class QueryParserException : LiftiException
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="QueryParserException"/> class.
        /// </summary>
        public QueryParserException()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="QueryParserException"/> class.
        /// </summary>
        /// <param name="message">The exception message.</param>
        public QueryParserException(string message)
            : base(message)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="QueryParserException"/> class.
        /// </summary>
        /// <param name="message">The exception message.</param>
        /// <param name="args">The message arguments.</param>
        public QueryParserException(string message, params object[] args)
            : base(String.Format(CultureInfo.CurrentCulture, message, args))
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="QueryParserException"/> class.
        /// </summary>
        /// <param name="message">The exception message.</param>
        /// <param name="inner">The inner exception.</param>
        public QueryParserException(string message, Exception inner)
            : base(message, inner)
        {
        }

#if !NETFX_CORE
        /// <summary>
        /// Initializes a new instance of the <see cref="QueryParserException"/> class.
        /// </summary>
        /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
        /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
        /// <exception cref="T:System.ArgumentNullException">
        /// The <paramref name="info"/> parameter is null.
        /// </exception>
        /// <exception cref="T:System.Runtime.Serialization.SerializationException">
        /// The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0).
        /// </exception>
        protected QueryParserException(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
        }
#endif
    }
}
